



// This code is a generated code by a tool
// designed and coded by Shohdi Mohamed Elsheemy ( shohdi@gmail.com )            

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.Common;
using Shohdi.DataHandler;
using System.Data;




namespace DatabaseComponent
{
    
    public partial class TicketAllDetailsDB
    {
         string _Connection = "";


        public string Connection
        {
            get { return _Connection; }
            set { _Connection = value; }
        }


       
         string _Provider = "System.Data.SqlClient";

        
        public string Provider
        {
            get { return _Provider; }
            set { _Provider = value; }
        }



        public TicketAllDetailsDB()
        {
        }

        public TicketAllDetailsDB(string __Connection,params string [] __Provider)
        {

            if (__Provider.Length > 0)
                _Provider = __Provider[0];

            _Connection = __Connection;
            
        }




        public List<TicketAllDetails> Select(ClassDataHandler con, string strTop, string strWhere, params DbParameter[] whereParams)
        {
            if (whereParams == null)
                whereParams = new DbParameter[0];

            List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

            string strQuery = " select " + strTop  + " * from dbo.[TicketAllDetails]  " ;

            if (strWhere != "")
            {
                strQuery = strQuery + "  " + strWhere;
            }

            DbDataReader dr = con.SelectDataReader(strQuery, CommandType.Text, whereParams);


            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    TicketAllDetails obj = new TicketAllDetails();
 if (dr["TicketID"] != DBNull.Value)
                    {
                        obj.TicketID = (System.Int64)dr["TicketID"];
                    }
                    else
                    {
                        obj.TicketID = -1;
                    } 
 if (dr["OwnerID"] != DBNull.Value)
                    {
                        obj.OwnerID = (System.Int64?)dr["OwnerID"];
                    }
                    else
                    {
                        obj.OwnerID = null;
                    } 
 if (dr["Badge"] != DBNull.Value)
                    {
                        obj.Badge = (System.String)dr["Badge"];
                    }
                    else
                    {
                        obj.Badge = null;
                    } 
 if (dr["PersonNameEN"] != DBNull.Value)
                    {
                        obj.PersonNameEN = (System.String)dr["PersonNameEN"];
                    }
                    else
                    {
                        obj.PersonNameEN = null;
                    } 
 if (dr["PersonNameAR"] != DBNull.Value)
                    {
                        obj.PersonNameAR = (System.String)dr["PersonNameAR"];
                    }
                    else
                    {
                        obj.PersonNameAR = null;
                    } 
 if (dr["RequestTypeID"] != DBNull.Value)
                    {
                        obj.RequestTypeID = (System.Int64?)dr["RequestTypeID"];
                    }
                    else
                    {
                        obj.RequestTypeID = null;
                    } 
 if (dr["RequestTypeAR"] != DBNull.Value)
                    {
                        obj.RequestTypeAR = (System.String)dr["RequestTypeAR"];
                    }
                    else
                    {
                        obj.RequestTypeAR = null;
                    } 
 if (dr["RequestTypeEN"] != DBNull.Value)
                    {
                        obj.RequestTypeEN = (System.String)dr["RequestTypeEN"];
                    }
                    else
                    {
                        obj.RequestTypeEN = null;
                    } 
 if (dr["Details"] != DBNull.Value)
                    {
                        obj.Details = (System.String)dr["Details"];
                    }
                    else
                    {
                        obj.Details = "";
                    } 
 if (dr["StatusID"] != DBNull.Value)
                    {
                        obj.StatusID = (System.Int64?)dr["StatusID"];
                    }
                    else
                    {
                        obj.StatusID = null;
                    } 
 if (dr["StatusAR"] != DBNull.Value)
                    {
                        obj.StatusAR = (System.String)dr["StatusAR"];
                    }
                    else
                    {
                        obj.StatusAR = null;
                    } 
 if (dr["StatusEN"] != DBNull.Value)
                    {
                        obj.StatusEN = (System.String)dr["StatusEN"];
                    }
                    else
                    {
                        obj.StatusEN = null;
                    } 
 if (dr["OperatorID"] != DBNull.Value)
                    {
                        obj.OperatorID = (System.Int64?)dr["OperatorID"];
                    }
                    else
                    {
                        obj.OperatorID = null;
                    } 
 if (dr["AssignedToAR"] != DBNull.Value)
                    {
                        obj.AssignedToAR = (System.String)dr["AssignedToAR"];
                    }
                    else
                    {
                        obj.AssignedToAR = null;
                    } 
 if (dr["AssignedToEN"] != DBNull.Value)
                    {
                        obj.AssignedToEN = (System.String)dr["AssignedToEN"];
                    }
                    else
                    {
                        obj.AssignedToEN = null;
                    } 
 if (dr["PriorityID"] != DBNull.Value)
                    {
                        obj.PriorityID = (System.Int64?)dr["PriorityID"];
                    }
                    else
                    {
                        obj.PriorityID = null;
                    } 
 if (dr["PriorityAR"] != DBNull.Value)
                    {
                        obj.PriorityAR = (System.String)dr["PriorityAR"];
                    }
                    else
                    {
                        obj.PriorityAR = null;
                    } 
 if (dr["PriorityEN"] != DBNull.Value)
                    {
                        obj.PriorityEN = (System.String)dr["PriorityEN"];
                    }
                    else
                    {
                        obj.PriorityEN = null;
                    } 
 if (dr["TicketDuration"] != DBNull.Value)
                    {
                        obj.TicketDuration = (System.Int64?)dr["TicketDuration"];
                    }
                    else
                    {
                        obj.TicketDuration = null;
                    } 
 if (dr["CreateTime"] != DBNull.Value)
                    {
                        obj.CreateTime = (System.DateTime)dr["CreateTime"];
                    }
                    else
                    {
                        obj.CreateTime = DateTime.Now;
                    } 
 if (dr["ModifyTime"] != DBNull.Value)
                    {
                        obj.ModifyTime = (System.DateTime)dr["ModifyTime"];
                    }
                    else
                    {
                        obj.ModifyTime = DateTime.Now;
                    } 
 if (dr["Note"] != DBNull.Value)
                    {
                        obj.Note = (System.String)dr["Note"];
                    }
                    else
                    {
                        obj.Note = "";
                    } 
 if (dr["AreaID"] != DBNull.Value)
                    {
                        obj.AreaID = (System.Int64?)dr["AreaID"];
                    }
                    else
                    {
                        obj.AreaID = null;
                    } 
 if (dr["AreaAR"] != DBNull.Value)
                    {
                        obj.AreaAR = (System.String)dr["AreaAR"];
                    }
                    else
                    {
                        obj.AreaAR = null;
                    } 
 if (dr["AreaEN"] != DBNull.Value)
                    {
                        obj.AreaEN = (System.String)dr["AreaEN"];
                    }
                    else
                    {
                        obj.AreaEN = null;
                    } 
 if (dr["IsBadSituation"] != DBNull.Value)
                    {
                        obj.IsBadSituation = (System.Int32?)dr["IsBadSituation"];
                    }
                    else
                    {
                        obj.IsBadSituation = null;
                    } 



                    lstRet.Add(obj);
                   

                }
            }

            dr.Close();


            return lstRet;
        }


        public List<TicketAllDetails> Select(string strTop, string strWhere, params DbParameter[] whereParams)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<TicketAllDetails> lstRet = Select(con, strTop, strWhere, whereParams);

            con.CloseConnection();

            return lstRet;
        }

        



        public void Insert(ClassDataHandler con , TicketAllDetails obj)
        {
            
            

                    DbParameter prmTicketID = con.createParameter();
                    prmTicketID.ParameterName = "@TicketID";
                    prmTicketID.DbType =DbType.Int64;
                    if (obj.TicketID == null)
                    {
                        prmTicketID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmTicketID.Value = obj.TicketID;
                    }
                

                    


                    DbParameter prmOwnerID = con.createParameter();
                    prmOwnerID.ParameterName = "@OwnerID";
                    prmOwnerID.DbType =DbType.Int64;
                    if (obj.OwnerID == null)
                    {
                        prmOwnerID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOwnerID.Value = obj.OwnerID;
                    }
                

                    


                    DbParameter prmBadge = con.createParameter();
                    prmBadge.ParameterName = "@Badge";
                    prmBadge.DbType =DbType.String;
                    if (obj.Badge == null)
                    {
                        prmBadge.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBadge.Value = obj.Badge;
                    }
                

                    


                    DbParameter prmPersonNameEN = con.createParameter();
                    prmPersonNameEN.ParameterName = "@PersonNameEN";
                    prmPersonNameEN.DbType =DbType.String;
                    if (obj.PersonNameEN == null)
                    {
                        prmPersonNameEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonNameEN.Value = obj.PersonNameEN;
                    }
                

                    


                    DbParameter prmPersonNameAR = con.createParameter();
                    prmPersonNameAR.ParameterName = "@PersonNameAR";
                    prmPersonNameAR.DbType =DbType.String;
                    if (obj.PersonNameAR == null)
                    {
                        prmPersonNameAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonNameAR.Value = obj.PersonNameAR;
                    }
                

                    


                    DbParameter prmRequestTypeID = con.createParameter();
                    prmRequestTypeID.ParameterName = "@RequestTypeID";
                    prmRequestTypeID.DbType =DbType.Int64;
                    if (obj.RequestTypeID == null)
                    {
                        prmRequestTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeID.Value = obj.RequestTypeID;
                    }
                

                    


                    DbParameter prmRequestTypeAR = con.createParameter();
                    prmRequestTypeAR.ParameterName = "@RequestTypeAR";
                    prmRequestTypeAR.DbType =DbType.String;
                    if (obj.RequestTypeAR == null)
                    {
                        prmRequestTypeAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeAR.Value = obj.RequestTypeAR;
                    }
                

                    


                    DbParameter prmRequestTypeEN = con.createParameter();
                    prmRequestTypeEN.ParameterName = "@RequestTypeEN";
                    prmRequestTypeEN.DbType =DbType.String;
                    if (obj.RequestTypeEN == null)
                    {
                        prmRequestTypeEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeEN.Value = obj.RequestTypeEN;
                    }
                

                    


                    DbParameter prmDetails = con.createParameter();
                    prmDetails.ParameterName = "@Details";
                    prmDetails.DbType =DbType.String;
                    if (obj.Details == null)
                    {
                        prmDetails.Value = DBNull.Value;
                    }
                    else
                    {
                        prmDetails.Value = obj.Details;
                    }
                

                    


                    DbParameter prmStatusID = con.createParameter();
                    prmStatusID.ParameterName = "@StatusID";
                    prmStatusID.DbType =DbType.Int64;
                    if (obj.StatusID == null)
                    {
                        prmStatusID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusID.Value = obj.StatusID;
                    }
                

                    


                    DbParameter prmStatusAR = con.createParameter();
                    prmStatusAR.ParameterName = "@StatusAR";
                    prmStatusAR.DbType =DbType.String;
                    if (obj.StatusAR == null)
                    {
                        prmStatusAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusAR.Value = obj.StatusAR;
                    }
                

                    


                    DbParameter prmStatusEN = con.createParameter();
                    prmStatusEN.ParameterName = "@StatusEN";
                    prmStatusEN.DbType =DbType.String;
                    if (obj.StatusEN == null)
                    {
                        prmStatusEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusEN.Value = obj.StatusEN;
                    }
                

                    


                    DbParameter prmOperatorID = con.createParameter();
                    prmOperatorID.ParameterName = "@OperatorID";
                    prmOperatorID.DbType =DbType.Int64;
                    if (obj.OperatorID == null)
                    {
                        prmOperatorID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOperatorID.Value = obj.OperatorID;
                    }
                

                    


                    DbParameter prmAssignedToAR = con.createParameter();
                    prmAssignedToAR.ParameterName = "@AssignedToAR";
                    prmAssignedToAR.DbType =DbType.String;
                    if (obj.AssignedToAR == null)
                    {
                        prmAssignedToAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAssignedToAR.Value = obj.AssignedToAR;
                    }
                

                    


                    DbParameter prmAssignedToEN = con.createParameter();
                    prmAssignedToEN.ParameterName = "@AssignedToEN";
                    prmAssignedToEN.DbType =DbType.String;
                    if (obj.AssignedToEN == null)
                    {
                        prmAssignedToEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAssignedToEN.Value = obj.AssignedToEN;
                    }
                

                    


                    DbParameter prmPriorityID = con.createParameter();
                    prmPriorityID.ParameterName = "@PriorityID";
                    prmPriorityID.DbType =DbType.Int64;
                    if (obj.PriorityID == null)
                    {
                        prmPriorityID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityID.Value = obj.PriorityID;
                    }
                

                    


                    DbParameter prmPriorityAR = con.createParameter();
                    prmPriorityAR.ParameterName = "@PriorityAR";
                    prmPriorityAR.DbType =DbType.String;
                    if (obj.PriorityAR == null)
                    {
                        prmPriorityAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityAR.Value = obj.PriorityAR;
                    }
                

                    


                    DbParameter prmPriorityEN = con.createParameter();
                    prmPriorityEN.ParameterName = "@PriorityEN";
                    prmPriorityEN.DbType =DbType.String;
                    if (obj.PriorityEN == null)
                    {
                        prmPriorityEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityEN.Value = obj.PriorityEN;
                    }
                

                    


                    DbParameter prmTicketDuration = con.createParameter();
                    prmTicketDuration.ParameterName = "@TicketDuration";
                    prmTicketDuration.DbType =DbType.Int64;
                    if (obj.TicketDuration == null)
                    {
                        prmTicketDuration.Value = DBNull.Value;
                    }
                    else
                    {
                        prmTicketDuration.Value = obj.TicketDuration;
                    }
                

                    


                    DbParameter prmCreateTime = con.createParameter();
                    prmCreateTime.ParameterName = "@CreateTime";
                    prmCreateTime.DbType =DbType.DateTime;
                    if (obj.CreateTime == null)
                    {
                        prmCreateTime.Value = DBNull.Value;
                    }
                    else
                    {
                        prmCreateTime.Value = obj.CreateTime;
                    }
                

                    


                    DbParameter prmModifyTime = con.createParameter();
                    prmModifyTime.ParameterName = "@ModifyTime";
                    prmModifyTime.DbType =DbType.DateTime;
                    if (obj.ModifyTime == null)
                    {
                        prmModifyTime.Value = DBNull.Value;
                    }
                    else
                    {
                        prmModifyTime.Value = obj.ModifyTime;
                    }
                

                    


                    DbParameter prmNote = con.createParameter();
                    prmNote.ParameterName = "@Note";
                    prmNote.DbType =DbType.String;
                    if (obj.Note == null)
                    {
                        prmNote.Value = DBNull.Value;
                    }
                    else
                    {
                        prmNote.Value = obj.Note;
                    }
                

                    


                    DbParameter prmAreaID = con.createParameter();
                    prmAreaID.ParameterName = "@AreaID";
                    prmAreaID.DbType =DbType.Int64;
                    if (obj.AreaID == null)
                    {
                        prmAreaID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaID.Value = obj.AreaID;
                    }
                

                    


                    DbParameter prmAreaAR = con.createParameter();
                    prmAreaAR.ParameterName = "@AreaAR";
                    prmAreaAR.DbType =DbType.String;
                    if (obj.AreaAR == null)
                    {
                        prmAreaAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaAR.Value = obj.AreaAR;
                    }
                

                    


                    DbParameter prmAreaEN = con.createParameter();
                    prmAreaEN.ParameterName = "@AreaEN";
                    prmAreaEN.DbType =DbType.String;
                    if (obj.AreaEN == null)
                    {
                        prmAreaEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaEN.Value = obj.AreaEN;
                    }
                

                    


                    DbParameter prmIsBadSituation = con.createParameter();
                    prmIsBadSituation.ParameterName = "@IsBadSituation";
                    prmIsBadSituation.DbType =DbType.Int32;
                    if (obj.IsBadSituation == null)
                    {
                        prmIsBadSituation.Value = DBNull.Value;
                    }
                    else
                    {
                        prmIsBadSituation.Value = obj.IsBadSituation;
                    }
                

                    


           



            string strQuery = " insert into dbo.[TicketAllDetails] ([TicketID],[OwnerID],[Badge],[PersonNameEN],[PersonNameAR],[RequestTypeID],[RequestTypeAR],[RequestTypeEN],[Details],[StatusID],[StatusAR],[StatusEN],[OperatorID],[AssignedToAR],[AssignedToEN],[PriorityID],[PriorityAR],[PriorityEN],[TicketDuration],[CreateTime],[ModifyTime],[Note],[AreaID],[AreaAR],[AreaEN],[IsBadSituation]) VALUES (@TicketID,@OwnerID,@Badge,@PersonNameEN,@PersonNameAR,@RequestTypeID,@RequestTypeAR,@RequestTypeEN,@Details,@StatusID,@StatusAR,@StatusEN,@OperatorID,@AssignedToAR,@AssignedToEN,@PriorityID,@PriorityAR,@PriorityEN,@TicketDuration,@CreateTime,@ModifyTime,@Note,@AreaID,@AreaAR,@AreaEN,@IsBadSituation) ; select SCOPE_IDENTITY() ";
 object scope = con.ExecuteScalar(strQuery, CommandType.Text, prmTicketID,prmOwnerID,prmBadge,prmPersonNameEN,prmPersonNameAR,prmRequestTypeID,prmRequestTypeAR,prmRequestTypeEN,prmDetails,prmStatusID,prmStatusAR,prmStatusEN,prmOperatorID,prmAssignedToAR,prmAssignedToEN,prmPriorityID,prmPriorityAR,prmPriorityEN,prmTicketDuration,prmCreateTime,prmModifyTime,prmNote,prmAreaID,prmAreaAR,prmAreaEN,prmIsBadSituation);


           

        }



        public void Insert(TicketAllDetails obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
            con.OpenConnection();

            Insert(con,obj);


            con.CloseConnection();
        }




        public void Update(ClassDataHandler con, TicketAllDetails obj)
        {
            
            

                    DbParameter prmTicketID = con.createParameter();
                    prmTicketID.ParameterName = "@TicketID";
                    prmTicketID.DbType =DbType.Int64;
                    if (obj.TicketID == null)
                    {
                        prmTicketID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmTicketID.Value = obj.TicketID;
                    }
                

                    


                    DbParameter prmOwnerID = con.createParameter();
                    prmOwnerID.ParameterName = "@OwnerID";
                    prmOwnerID.DbType =DbType.Int64;
                    if (obj.OwnerID == null)
                    {
                        prmOwnerID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOwnerID.Value = obj.OwnerID;
                    }
                

                    


                    DbParameter prmBadge = con.createParameter();
                    prmBadge.ParameterName = "@Badge";
                    prmBadge.DbType =DbType.String;
                    if (obj.Badge == null)
                    {
                        prmBadge.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBadge.Value = obj.Badge;
                    }
                

                    


                    DbParameter prmPersonNameEN = con.createParameter();
                    prmPersonNameEN.ParameterName = "@PersonNameEN";
                    prmPersonNameEN.DbType =DbType.String;
                    if (obj.PersonNameEN == null)
                    {
                        prmPersonNameEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonNameEN.Value = obj.PersonNameEN;
                    }
                

                    


                    DbParameter prmPersonNameAR = con.createParameter();
                    prmPersonNameAR.ParameterName = "@PersonNameAR";
                    prmPersonNameAR.DbType =DbType.String;
                    if (obj.PersonNameAR == null)
                    {
                        prmPersonNameAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonNameAR.Value = obj.PersonNameAR;
                    }
                

                    


                    DbParameter prmRequestTypeID = con.createParameter();
                    prmRequestTypeID.ParameterName = "@RequestTypeID";
                    prmRequestTypeID.DbType =DbType.Int64;
                    if (obj.RequestTypeID == null)
                    {
                        prmRequestTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeID.Value = obj.RequestTypeID;
                    }
                

                    


                    DbParameter prmRequestTypeAR = con.createParameter();
                    prmRequestTypeAR.ParameterName = "@RequestTypeAR";
                    prmRequestTypeAR.DbType =DbType.String;
                    if (obj.RequestTypeAR == null)
                    {
                        prmRequestTypeAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeAR.Value = obj.RequestTypeAR;
                    }
                

                    


                    DbParameter prmRequestTypeEN = con.createParameter();
                    prmRequestTypeEN.ParameterName = "@RequestTypeEN";
                    prmRequestTypeEN.DbType =DbType.String;
                    if (obj.RequestTypeEN == null)
                    {
                        prmRequestTypeEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRequestTypeEN.Value = obj.RequestTypeEN;
                    }
                

                    


                    DbParameter prmDetails = con.createParameter();
                    prmDetails.ParameterName = "@Details";
                    prmDetails.DbType =DbType.String;
                    if (obj.Details == null)
                    {
                        prmDetails.Value = DBNull.Value;
                    }
                    else
                    {
                        prmDetails.Value = obj.Details;
                    }
                

                    


                    DbParameter prmStatusID = con.createParameter();
                    prmStatusID.ParameterName = "@StatusID";
                    prmStatusID.DbType =DbType.Int64;
                    if (obj.StatusID == null)
                    {
                        prmStatusID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusID.Value = obj.StatusID;
                    }
                

                    


                    DbParameter prmStatusAR = con.createParameter();
                    prmStatusAR.ParameterName = "@StatusAR";
                    prmStatusAR.DbType =DbType.String;
                    if (obj.StatusAR == null)
                    {
                        prmStatusAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusAR.Value = obj.StatusAR;
                    }
                

                    


                    DbParameter prmStatusEN = con.createParameter();
                    prmStatusEN.ParameterName = "@StatusEN";
                    prmStatusEN.DbType =DbType.String;
                    if (obj.StatusEN == null)
                    {
                        prmStatusEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusEN.Value = obj.StatusEN;
                    }
                

                    


                    DbParameter prmOperatorID = con.createParameter();
                    prmOperatorID.ParameterName = "@OperatorID";
                    prmOperatorID.DbType =DbType.Int64;
                    if (obj.OperatorID == null)
                    {
                        prmOperatorID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOperatorID.Value = obj.OperatorID;
                    }
                

                    


                    DbParameter prmAssignedToAR = con.createParameter();
                    prmAssignedToAR.ParameterName = "@AssignedToAR";
                    prmAssignedToAR.DbType =DbType.String;
                    if (obj.AssignedToAR == null)
                    {
                        prmAssignedToAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAssignedToAR.Value = obj.AssignedToAR;
                    }
                

                    


                    DbParameter prmAssignedToEN = con.createParameter();
                    prmAssignedToEN.ParameterName = "@AssignedToEN";
                    prmAssignedToEN.DbType =DbType.String;
                    if (obj.AssignedToEN == null)
                    {
                        prmAssignedToEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAssignedToEN.Value = obj.AssignedToEN;
                    }
                

                    


                    DbParameter prmPriorityID = con.createParameter();
                    prmPriorityID.ParameterName = "@PriorityID";
                    prmPriorityID.DbType =DbType.Int64;
                    if (obj.PriorityID == null)
                    {
                        prmPriorityID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityID.Value = obj.PriorityID;
                    }
                

                    


                    DbParameter prmPriorityAR = con.createParameter();
                    prmPriorityAR.ParameterName = "@PriorityAR";
                    prmPriorityAR.DbType =DbType.String;
                    if (obj.PriorityAR == null)
                    {
                        prmPriorityAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityAR.Value = obj.PriorityAR;
                    }
                

                    


                    DbParameter prmPriorityEN = con.createParameter();
                    prmPriorityEN.ParameterName = "@PriorityEN";
                    prmPriorityEN.DbType =DbType.String;
                    if (obj.PriorityEN == null)
                    {
                        prmPriorityEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPriorityEN.Value = obj.PriorityEN;
                    }
                

                    


                    DbParameter prmTicketDuration = con.createParameter();
                    prmTicketDuration.ParameterName = "@TicketDuration";
                    prmTicketDuration.DbType =DbType.Int64;
                    if (obj.TicketDuration == null)
                    {
                        prmTicketDuration.Value = DBNull.Value;
                    }
                    else
                    {
                        prmTicketDuration.Value = obj.TicketDuration;
                    }
                

                    


                    DbParameter prmCreateTime = con.createParameter();
                    prmCreateTime.ParameterName = "@CreateTime";
                    prmCreateTime.DbType =DbType.DateTime;
                    if (obj.CreateTime == null)
                    {
                        prmCreateTime.Value = DBNull.Value;
                    }
                    else
                    {
                        prmCreateTime.Value = obj.CreateTime;
                    }
                

                    


                    DbParameter prmModifyTime = con.createParameter();
                    prmModifyTime.ParameterName = "@ModifyTime";
                    prmModifyTime.DbType =DbType.DateTime;
                    if (obj.ModifyTime == null)
                    {
                        prmModifyTime.Value = DBNull.Value;
                    }
                    else
                    {
                        prmModifyTime.Value = obj.ModifyTime;
                    }
                

                    


                    DbParameter prmNote = con.createParameter();
                    prmNote.ParameterName = "@Note";
                    prmNote.DbType =DbType.String;
                    if (obj.Note == null)
                    {
                        prmNote.Value = DBNull.Value;
                    }
                    else
                    {
                        prmNote.Value = obj.Note;
                    }
                

                    


                    DbParameter prmAreaID = con.createParameter();
                    prmAreaID.ParameterName = "@AreaID";
                    prmAreaID.DbType =DbType.Int64;
                    if (obj.AreaID == null)
                    {
                        prmAreaID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaID.Value = obj.AreaID;
                    }
                

                    


                    DbParameter prmAreaAR = con.createParameter();
                    prmAreaAR.ParameterName = "@AreaAR";
                    prmAreaAR.DbType =DbType.String;
                    if (obj.AreaAR == null)
                    {
                        prmAreaAR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaAR.Value = obj.AreaAR;
                    }
                

                    


                    DbParameter prmAreaEN = con.createParameter();
                    prmAreaEN.ParameterName = "@AreaEN";
                    prmAreaEN.DbType =DbType.String;
                    if (obj.AreaEN == null)
                    {
                        prmAreaEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmAreaEN.Value = obj.AreaEN;
                    }
                

                    


                    DbParameter prmIsBadSituation = con.createParameter();
                    prmIsBadSituation.ParameterName = "@IsBadSituation";
                    prmIsBadSituation.DbType =DbType.Int32;
                    if (obj.IsBadSituation == null)
                    {
                        prmIsBadSituation.Value = DBNull.Value;
                    }
                    else
                    {
                        prmIsBadSituation.Value = obj.IsBadSituation;
                    }
                

                    


           



            string strQuery = " update dbo.[TicketAllDetails] set [TicketID]=@TicketID,[OwnerID]=@OwnerID,[Badge]=@Badge,[PersonNameEN]=@PersonNameEN,[PersonNameAR]=@PersonNameAR,[RequestTypeID]=@RequestTypeID,[RequestTypeAR]=@RequestTypeAR,[RequestTypeEN]=@RequestTypeEN,[Details]=@Details,[StatusID]=@StatusID,[StatusAR]=@StatusAR,[StatusEN]=@StatusEN,[OperatorID]=@OperatorID,[AssignedToAR]=@AssignedToAR,[AssignedToEN]=@AssignedToEN,[PriorityID]=@PriorityID,[PriorityAR]=@PriorityAR,[PriorityEN]=@PriorityEN,[TicketDuration]=@TicketDuration,[CreateTime]=@CreateTime,[ModifyTime]=@ModifyTime,[Note]=@Note,[AreaID]=@AreaID,[AreaAR]=@AreaAR,[AreaEN]=@AreaEN,[IsBadSituation]=@IsBadSituation ";

            con.ExecuteNonQuery(strQuery, CommandType.Text,prmTicketID,prmOwnerID,prmBadge,prmPersonNameEN,prmPersonNameAR,prmRequestTypeID,prmRequestTypeAR,prmRequestTypeEN,prmDetails,prmStatusID,prmStatusAR,prmStatusEN,prmOperatorID,prmAssignedToAR,prmAssignedToEN,prmPriorityID,prmPriorityAR,prmPriorityEN,prmTicketDuration,prmCreateTime,prmModifyTime,prmNote,prmAreaID,prmAreaAR,prmAreaEN,prmIsBadSituation);

            

        }


        public void Update(TicketAllDetails obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
            con.OpenConnection();

            Update(con, obj);


            con.CloseConnection();
        }



        public void Delete(ClassDataHandler con, TicketAllDetails obj)
        {

            

           



           



            string strQuery = " delete from dbo.[TicketAllDetails]  "; 
                        con.ExecuteNonQuery(strQuery, CommandType.Text );  

             



        }


        public void Delete( TicketAllDetails obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            Delete(con, obj);

            con.CloseConnection();
        }





                    public List<TicketAllDetails> getTicketAllDetailsByTicketID(ClassDataHandler con,System.Int64 TicketID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmTicketID = con.createParameter();
                        prmTicketID.ParameterName = "@TicketID";
                        prmTicketID.DbType = DbType.Int64;
                        if (TicketID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmTicketID.Value = TicketID;
                        }


                        lstRet = Select(con, "" , " where [TicketID]=@TicketID ", prmTicketID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByTicketID(System.Int64 TicketID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByTicketID(con, TicketID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByOwnerID(ClassDataHandler con,System.Int64? OwnerID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmOwnerID = con.createParameter();
                        prmOwnerID.ParameterName = "@OwnerID";
                        prmOwnerID.DbType = DbType.Int64;
                        if (OwnerID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmOwnerID.Value = OwnerID;
                        }


                        lstRet = Select(con, "" , " where [OwnerID]=@OwnerID ", prmOwnerID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByOwnerID(System.Int64? OwnerID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByOwnerID(con, OwnerID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByBadge(ClassDataHandler con,System.String Badge)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType = DbType.String;
                        if (Badge == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmBadge.Value = Badge;
                        }


                        lstRet = Select(con, "" , " where [Badge]=@Badge ", prmBadge);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByBadge(System.String Badge)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByBadge(con, Badge);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByPersonNameEN(ClassDataHandler con,System.String PersonNameEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmPersonNameEN = con.createParameter();
                        prmPersonNameEN.ParameterName = "@PersonNameEN";
                        prmPersonNameEN.DbType = DbType.String;
                        if (PersonNameEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPersonNameEN.Value = PersonNameEN;
                        }


                        lstRet = Select(con, "" , " where [PersonNameEN]=@PersonNameEN ", prmPersonNameEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByPersonNameEN(System.String PersonNameEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByPersonNameEN(con, PersonNameEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByPersonNameAR(ClassDataHandler con,System.String PersonNameAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmPersonNameAR = con.createParameter();
                        prmPersonNameAR.ParameterName = "@PersonNameAR";
                        prmPersonNameAR.DbType = DbType.String;
                        if (PersonNameAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPersonNameAR.Value = PersonNameAR;
                        }


                        lstRet = Select(con, "" , " where [PersonNameAR]=@PersonNameAR ", prmPersonNameAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByPersonNameAR(System.String PersonNameAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByPersonNameAR(con, PersonNameAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeID(ClassDataHandler con,System.Int64? RequestTypeID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmRequestTypeID = con.createParameter();
                        prmRequestTypeID.ParameterName = "@RequestTypeID";
                        prmRequestTypeID.DbType = DbType.Int64;
                        if (RequestTypeID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRequestTypeID.Value = RequestTypeID;
                        }


                        lstRet = Select(con, "" , " where [RequestTypeID]=@RequestTypeID ", prmRequestTypeID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeID(System.Int64? RequestTypeID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByRequestTypeID(con, RequestTypeID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeAR(ClassDataHandler con,System.String RequestTypeAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmRequestTypeAR = con.createParameter();
                        prmRequestTypeAR.ParameterName = "@RequestTypeAR";
                        prmRequestTypeAR.DbType = DbType.String;
                        if (RequestTypeAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRequestTypeAR.Value = RequestTypeAR;
                        }


                        lstRet = Select(con, "" , " where [RequestTypeAR]=@RequestTypeAR ", prmRequestTypeAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeAR(System.String RequestTypeAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByRequestTypeAR(con, RequestTypeAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeEN(ClassDataHandler con,System.String RequestTypeEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmRequestTypeEN = con.createParameter();
                        prmRequestTypeEN.ParameterName = "@RequestTypeEN";
                        prmRequestTypeEN.DbType = DbType.String;
                        if (RequestTypeEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRequestTypeEN.Value = RequestTypeEN;
                        }


                        lstRet = Select(con, "" , " where [RequestTypeEN]=@RequestTypeEN ", prmRequestTypeEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByRequestTypeEN(System.String RequestTypeEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByRequestTypeEN(con, RequestTypeEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByDetails(ClassDataHandler con,System.String Details)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmDetails = con.createParameter();
                        prmDetails.ParameterName = "@Details";
                        prmDetails.DbType = DbType.String;
                        if (Details == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmDetails.Value = Details;
                        }


                        lstRet = Select(con, "" , " where [Details]=@Details ", prmDetails);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByDetails(System.String Details)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByDetails(con, Details);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByStatusID(ClassDataHandler con,System.Int64? StatusID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType = DbType.Int64;
                        if (StatusID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmStatusID.Value = StatusID;
                        }


                        lstRet = Select(con, "" , " where [StatusID]=@StatusID ", prmStatusID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByStatusID(System.Int64? StatusID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByStatusID(con, StatusID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByStatusAR(ClassDataHandler con,System.String StatusAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmStatusAR = con.createParameter();
                        prmStatusAR.ParameterName = "@StatusAR";
                        prmStatusAR.DbType = DbType.String;
                        if (StatusAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmStatusAR.Value = StatusAR;
                        }


                        lstRet = Select(con, "" , " where [StatusAR]=@StatusAR ", prmStatusAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByStatusAR(System.String StatusAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByStatusAR(con, StatusAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByStatusEN(ClassDataHandler con,System.String StatusEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmStatusEN = con.createParameter();
                        prmStatusEN.ParameterName = "@StatusEN";
                        prmStatusEN.DbType = DbType.String;
                        if (StatusEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmStatusEN.Value = StatusEN;
                        }


                        lstRet = Select(con, "" , " where [StatusEN]=@StatusEN ", prmStatusEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByStatusEN(System.String StatusEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByStatusEN(con, StatusEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByOperatorID(ClassDataHandler con,System.Int64? OperatorID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmOperatorID = con.createParameter();
                        prmOperatorID.ParameterName = "@OperatorID";
                        prmOperatorID.DbType = DbType.Int64;
                        if (OperatorID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmOperatorID.Value = OperatorID;
                        }


                        lstRet = Select(con, "" , " where [OperatorID]=@OperatorID ", prmOperatorID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByOperatorID(System.Int64? OperatorID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByOperatorID(con, OperatorID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByAssignedToAR(ClassDataHandler con,System.String AssignedToAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmAssignedToAR = con.createParameter();
                        prmAssignedToAR.ParameterName = "@AssignedToAR";
                        prmAssignedToAR.DbType = DbType.String;
                        if (AssignedToAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmAssignedToAR.Value = AssignedToAR;
                        }


                        lstRet = Select(con, "" , " where [AssignedToAR]=@AssignedToAR ", prmAssignedToAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByAssignedToAR(System.String AssignedToAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByAssignedToAR(con, AssignedToAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByAssignedToEN(ClassDataHandler con,System.String AssignedToEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmAssignedToEN = con.createParameter();
                        prmAssignedToEN.ParameterName = "@AssignedToEN";
                        prmAssignedToEN.DbType = DbType.String;
                        if (AssignedToEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmAssignedToEN.Value = AssignedToEN;
                        }


                        lstRet = Select(con, "" , " where [AssignedToEN]=@AssignedToEN ", prmAssignedToEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByAssignedToEN(System.String AssignedToEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByAssignedToEN(con, AssignedToEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByPriorityID(ClassDataHandler con,System.Int64? PriorityID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmPriorityID = con.createParameter();
                        prmPriorityID.ParameterName = "@PriorityID";
                        prmPriorityID.DbType = DbType.Int64;
                        if (PriorityID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPriorityID.Value = PriorityID;
                        }


                        lstRet = Select(con, "" , " where [PriorityID]=@PriorityID ", prmPriorityID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByPriorityID(System.Int64? PriorityID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByPriorityID(con, PriorityID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByPriorityAR(ClassDataHandler con,System.String PriorityAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmPriorityAR = con.createParameter();
                        prmPriorityAR.ParameterName = "@PriorityAR";
                        prmPriorityAR.DbType = DbType.String;
                        if (PriorityAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPriorityAR.Value = PriorityAR;
                        }


                        lstRet = Select(con, "" , " where [PriorityAR]=@PriorityAR ", prmPriorityAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByPriorityAR(System.String PriorityAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByPriorityAR(con, PriorityAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByPriorityEN(ClassDataHandler con,System.String PriorityEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmPriorityEN = con.createParameter();
                        prmPriorityEN.ParameterName = "@PriorityEN";
                        prmPriorityEN.DbType = DbType.String;
                        if (PriorityEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPriorityEN.Value = PriorityEN;
                        }


                        lstRet = Select(con, "" , " where [PriorityEN]=@PriorityEN ", prmPriorityEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByPriorityEN(System.String PriorityEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByPriorityEN(con, PriorityEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByTicketDuration(ClassDataHandler con,System.Int64? TicketDuration)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmTicketDuration = con.createParameter();
                        prmTicketDuration.ParameterName = "@TicketDuration";
                        prmTicketDuration.DbType = DbType.Int64;
                        if (TicketDuration == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmTicketDuration.Value = TicketDuration;
                        }


                        lstRet = Select(con, "" , " where [TicketDuration]=@TicketDuration ", prmTicketDuration);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByTicketDuration(System.Int64? TicketDuration)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByTicketDuration(con, TicketDuration);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByCreateTime(ClassDataHandler con,System.DateTime CreateTime)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmCreateTime = con.createParameter();
                        prmCreateTime.ParameterName = "@CreateTime";
                        prmCreateTime.DbType = DbType.DateTime;
                        if (CreateTime == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmCreateTime.Value = CreateTime;
                        }


                        lstRet = Select(con, "" , " where [CreateTime]=@CreateTime ", prmCreateTime);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByCreateTime(System.DateTime CreateTime)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByCreateTime(con, CreateTime);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByModifyTime(ClassDataHandler con,System.DateTime ModifyTime)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmModifyTime = con.createParameter();
                        prmModifyTime.ParameterName = "@ModifyTime";
                        prmModifyTime.DbType = DbType.DateTime;
                        if (ModifyTime == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmModifyTime.Value = ModifyTime;
                        }


                        lstRet = Select(con, "" , " where [ModifyTime]=@ModifyTime ", prmModifyTime);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByModifyTime(System.DateTime ModifyTime)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByModifyTime(con, ModifyTime);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByNote(ClassDataHandler con,System.String Note)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmNote = con.createParameter();
                        prmNote.ParameterName = "@Note";
                        prmNote.DbType = DbType.String;
                        if (Note == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmNote.Value = Note;
                        }


                        lstRet = Select(con, "" , " where [Note]=@Note ", prmNote);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByNote(System.String Note)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByNote(con, Note);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByAreaID(ClassDataHandler con,System.Int64? AreaID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmAreaID = con.createParameter();
                        prmAreaID.ParameterName = "@AreaID";
                        prmAreaID.DbType = DbType.Int64;
                        if (AreaID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmAreaID.Value = AreaID;
                        }


                        lstRet = Select(con, "" , " where [AreaID]=@AreaID ", prmAreaID);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByAreaID(System.Int64? AreaID)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByAreaID(con, AreaID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByAreaAR(ClassDataHandler con,System.String AreaAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmAreaAR = con.createParameter();
                        prmAreaAR.ParameterName = "@AreaAR";
                        prmAreaAR.DbType = DbType.String;
                        if (AreaAR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmAreaAR.Value = AreaAR;
                        }


                        lstRet = Select(con, "" , " where [AreaAR]=@AreaAR ", prmAreaAR);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByAreaAR(System.String AreaAR)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByAreaAR(con, AreaAR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByAreaEN(ClassDataHandler con,System.String AreaEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmAreaEN = con.createParameter();
                        prmAreaEN.ParameterName = "@AreaEN";
                        prmAreaEN.DbType = DbType.String;
                        if (AreaEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmAreaEN.Value = AreaEN;
                        }


                        lstRet = Select(con, "" , " where [AreaEN]=@AreaEN ", prmAreaEN);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByAreaEN(System.String AreaEN)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByAreaEN(con, AreaEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<TicketAllDetails> getTicketAllDetailsByIsBadSituation(ClassDataHandler con,System.Int32? IsBadSituation)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();


                        DbParameter prmIsBadSituation = con.createParameter();
                        prmIsBadSituation.ParameterName = "@IsBadSituation";
                        prmIsBadSituation.DbType = DbType.Int32;
                        if (IsBadSituation == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmIsBadSituation.Value = IsBadSituation;
                        }


                        lstRet = Select(con, "" , " where [IsBadSituation]=@IsBadSituation ", prmIsBadSituation);



                        return lstRet;

                    }


                    public List<TicketAllDetails> getTicketAllDetailsByIsBadSituation(System.Int32? IsBadSituation)
                    {
                        List<TicketAllDetails> lstRet = new List<TicketAllDetails>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getTicketAllDetailsByIsBadSituation(con, IsBadSituation);

                        con.CloseConnection();

                        return lstRet;

                    }



                

            
public List<TicketAllDetails> Search(ClassDataHandler con, TicketAllDetails obj)
        {
            string strWhere = "";
            List<DbParameter> lstParameters = new List<DbParameter>();

            
                    if (obj.TicketID != -1)
                    {
                        DbParameter prmTicketID = con.createParameter();
                        prmTicketID.ParameterName = "@TicketID";
                        prmTicketID.DbType =DbType.Int64;
                        if (obj.TicketID == null)
                        {
                            prmTicketID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmTicketID.Value = obj.TicketID;
                        }
                        strWhere += " [TicketID]=@TicketID AND ";
                        lstParameters.Add(prmTicketID);
                     }



                    

                    if (obj.OwnerID != null)
                    {
                        DbParameter prmOwnerID = con.createParameter();
                        prmOwnerID.ParameterName = "@OwnerID";
                        prmOwnerID.DbType =DbType.Int64;
                        if (obj.OwnerID == null)
                        {
                            prmOwnerID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOwnerID.Value = obj.OwnerID;
                        }
                        strWhere += " [OwnerID]=@OwnerID AND ";
                        lstParameters.Add(prmOwnerID);
                     }



                    

                    if (obj.Badge != null)
                    {
                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType =DbType.String;
                        if (obj.Badge == null)
                        {
                            prmBadge.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBadge.Value = obj.Badge;
                        }
                        strWhere += " [Badge]=@Badge AND ";
                        lstParameters.Add(prmBadge);
                     }



                    

                    if (obj.PersonNameEN != null)
                    {
                        DbParameter prmPersonNameEN = con.createParameter();
                        prmPersonNameEN.ParameterName = "@PersonNameEN";
                        prmPersonNameEN.DbType =DbType.String;
                        if (obj.PersonNameEN == null)
                        {
                            prmPersonNameEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonNameEN.Value = obj.PersonNameEN;
                        }
                        strWhere += " [PersonNameEN]=@PersonNameEN AND ";
                        lstParameters.Add(prmPersonNameEN);
                     }



                    

                    if (obj.PersonNameAR != null)
                    {
                        DbParameter prmPersonNameAR = con.createParameter();
                        prmPersonNameAR.ParameterName = "@PersonNameAR";
                        prmPersonNameAR.DbType =DbType.String;
                        if (obj.PersonNameAR == null)
                        {
                            prmPersonNameAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonNameAR.Value = obj.PersonNameAR;
                        }
                        strWhere += " [PersonNameAR]=@PersonNameAR AND ";
                        lstParameters.Add(prmPersonNameAR);
                     }



                    

                    if (obj.RequestTypeID != null)
                    {
                        DbParameter prmRequestTypeID = con.createParameter();
                        prmRequestTypeID.ParameterName = "@RequestTypeID";
                        prmRequestTypeID.DbType =DbType.Int64;
                        if (obj.RequestTypeID == null)
                        {
                            prmRequestTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeID.Value = obj.RequestTypeID;
                        }
                        strWhere += " [RequestTypeID]=@RequestTypeID AND ";
                        lstParameters.Add(prmRequestTypeID);
                     }



                    

                    if (obj.RequestTypeAR != null)
                    {
                        DbParameter prmRequestTypeAR = con.createParameter();
                        prmRequestTypeAR.ParameterName = "@RequestTypeAR";
                        prmRequestTypeAR.DbType =DbType.String;
                        if (obj.RequestTypeAR == null)
                        {
                            prmRequestTypeAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeAR.Value = obj.RequestTypeAR;
                        }
                        strWhere += " [RequestTypeAR]=@RequestTypeAR AND ";
                        lstParameters.Add(prmRequestTypeAR);
                     }



                    

                    if (obj.RequestTypeEN != null)
                    {
                        DbParameter prmRequestTypeEN = con.createParameter();
                        prmRequestTypeEN.ParameterName = "@RequestTypeEN";
                        prmRequestTypeEN.DbType =DbType.String;
                        if (obj.RequestTypeEN == null)
                        {
                            prmRequestTypeEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeEN.Value = obj.RequestTypeEN;
                        }
                        strWhere += " [RequestTypeEN]=@RequestTypeEN AND ";
                        lstParameters.Add(prmRequestTypeEN);
                     }



                    

                    if (obj.Details != "")
                    {
                        DbParameter prmDetails = con.createParameter();
                        prmDetails.ParameterName = "@Details";
                        prmDetails.DbType =DbType.String;
                        if (obj.Details == null)
                        {
                            prmDetails.Value = DBNull.Value;
                        }
                        else
                        {
                            prmDetails.Value = obj.Details;
                        }
                        strWhere += " [Details]=@Details AND ";
                        lstParameters.Add(prmDetails);
                     }



                    

                    if (obj.StatusID != null)
                    {
                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType =DbType.Int64;
                        if (obj.StatusID == null)
                        {
                            prmStatusID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusID.Value = obj.StatusID;
                        }
                        strWhere += " [StatusID]=@StatusID AND ";
                        lstParameters.Add(prmStatusID);
                     }



                    

                    if (obj.StatusAR != null)
                    {
                        DbParameter prmStatusAR = con.createParameter();
                        prmStatusAR.ParameterName = "@StatusAR";
                        prmStatusAR.DbType =DbType.String;
                        if (obj.StatusAR == null)
                        {
                            prmStatusAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusAR.Value = obj.StatusAR;
                        }
                        strWhere += " [StatusAR]=@StatusAR AND ";
                        lstParameters.Add(prmStatusAR);
                     }



                    

                    if (obj.StatusEN != null)
                    {
                        DbParameter prmStatusEN = con.createParameter();
                        prmStatusEN.ParameterName = "@StatusEN";
                        prmStatusEN.DbType =DbType.String;
                        if (obj.StatusEN == null)
                        {
                            prmStatusEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusEN.Value = obj.StatusEN;
                        }
                        strWhere += " [StatusEN]=@StatusEN AND ";
                        lstParameters.Add(prmStatusEN);
                     }



                    

                    if (obj.OperatorID != null)
                    {
                        DbParameter prmOperatorID = con.createParameter();
                        prmOperatorID.ParameterName = "@OperatorID";
                        prmOperatorID.DbType =DbType.Int64;
                        if (obj.OperatorID == null)
                        {
                            prmOperatorID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOperatorID.Value = obj.OperatorID;
                        }
                        strWhere += " [OperatorID]=@OperatorID AND ";
                        lstParameters.Add(prmOperatorID);
                     }



                    

                    if (obj.AssignedToAR != null)
                    {
                        DbParameter prmAssignedToAR = con.createParameter();
                        prmAssignedToAR.ParameterName = "@AssignedToAR";
                        prmAssignedToAR.DbType =DbType.String;
                        if (obj.AssignedToAR == null)
                        {
                            prmAssignedToAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAssignedToAR.Value = obj.AssignedToAR;
                        }
                        strWhere += " [AssignedToAR]=@AssignedToAR AND ";
                        lstParameters.Add(prmAssignedToAR);
                     }



                    

                    if (obj.AssignedToEN != null)
                    {
                        DbParameter prmAssignedToEN = con.createParameter();
                        prmAssignedToEN.ParameterName = "@AssignedToEN";
                        prmAssignedToEN.DbType =DbType.String;
                        if (obj.AssignedToEN == null)
                        {
                            prmAssignedToEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAssignedToEN.Value = obj.AssignedToEN;
                        }
                        strWhere += " [AssignedToEN]=@AssignedToEN AND ";
                        lstParameters.Add(prmAssignedToEN);
                     }



                    

                    if (obj.PriorityID != null)
                    {
                        DbParameter prmPriorityID = con.createParameter();
                        prmPriorityID.ParameterName = "@PriorityID";
                        prmPriorityID.DbType =DbType.Int64;
                        if (obj.PriorityID == null)
                        {
                            prmPriorityID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityID.Value = obj.PriorityID;
                        }
                        strWhere += " [PriorityID]=@PriorityID AND ";
                        lstParameters.Add(prmPriorityID);
                     }



                    

                    if (obj.PriorityAR != null)
                    {
                        DbParameter prmPriorityAR = con.createParameter();
                        prmPriorityAR.ParameterName = "@PriorityAR";
                        prmPriorityAR.DbType =DbType.String;
                        if (obj.PriorityAR == null)
                        {
                            prmPriorityAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityAR.Value = obj.PriorityAR;
                        }
                        strWhere += " [PriorityAR]=@PriorityAR AND ";
                        lstParameters.Add(prmPriorityAR);
                     }



                    

                    if (obj.PriorityEN != null)
                    {
                        DbParameter prmPriorityEN = con.createParameter();
                        prmPriorityEN.ParameterName = "@PriorityEN";
                        prmPriorityEN.DbType =DbType.String;
                        if (obj.PriorityEN == null)
                        {
                            prmPriorityEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityEN.Value = obj.PriorityEN;
                        }
                        strWhere += " [PriorityEN]=@PriorityEN AND ";
                        lstParameters.Add(prmPriorityEN);
                     }



                    

                    if (obj.TicketDuration != null)
                    {
                        DbParameter prmTicketDuration = con.createParameter();
                        prmTicketDuration.ParameterName = "@TicketDuration";
                        prmTicketDuration.DbType =DbType.Int64;
                        if (obj.TicketDuration == null)
                        {
                            prmTicketDuration.Value = DBNull.Value;
                        }
                        else
                        {
                            prmTicketDuration.Value = obj.TicketDuration;
                        }
                        strWhere += " [TicketDuration]=@TicketDuration AND ";
                        lstParameters.Add(prmTicketDuration);
                     }



                    

                    if (obj.CreateTime != DateTime.Now)
                    {
                        DbParameter prmCreateTime = con.createParameter();
                        prmCreateTime.ParameterName = "@CreateTime";
                        prmCreateTime.DbType =DbType.DateTime;
                        if (obj.CreateTime == null)
                        {
                            prmCreateTime.Value = DBNull.Value;
                        }
                        else
                        {
                            prmCreateTime.Value = obj.CreateTime;
                        }
                        strWhere += " [CreateTime]=@CreateTime AND ";
                        lstParameters.Add(prmCreateTime);
                     }



                    

                    if (obj.ModifyTime != DateTime.Now)
                    {
                        DbParameter prmModifyTime = con.createParameter();
                        prmModifyTime.ParameterName = "@ModifyTime";
                        prmModifyTime.DbType =DbType.DateTime;
                        if (obj.ModifyTime == null)
                        {
                            prmModifyTime.Value = DBNull.Value;
                        }
                        else
                        {
                            prmModifyTime.Value = obj.ModifyTime;
                        }
                        strWhere += " [ModifyTime]=@ModifyTime AND ";
                        lstParameters.Add(prmModifyTime);
                     }



                    

                    if (obj.Note != "")
                    {
                        DbParameter prmNote = con.createParameter();
                        prmNote.ParameterName = "@Note";
                        prmNote.DbType =DbType.String;
                        if (obj.Note == null)
                        {
                            prmNote.Value = DBNull.Value;
                        }
                        else
                        {
                            prmNote.Value = obj.Note;
                        }
                        strWhere += " [Note]=@Note AND ";
                        lstParameters.Add(prmNote);
                     }



                    

                    if (obj.AreaID != null)
                    {
                        DbParameter prmAreaID = con.createParameter();
                        prmAreaID.ParameterName = "@AreaID";
                        prmAreaID.DbType =DbType.Int64;
                        if (obj.AreaID == null)
                        {
                            prmAreaID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaID.Value = obj.AreaID;
                        }
                        strWhere += " [AreaID]=@AreaID AND ";
                        lstParameters.Add(prmAreaID);
                     }



                    

                    if (obj.AreaAR != null)
                    {
                        DbParameter prmAreaAR = con.createParameter();
                        prmAreaAR.ParameterName = "@AreaAR";
                        prmAreaAR.DbType =DbType.String;
                        if (obj.AreaAR == null)
                        {
                            prmAreaAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaAR.Value = obj.AreaAR;
                        }
                        strWhere += " [AreaAR]=@AreaAR AND ";
                        lstParameters.Add(prmAreaAR);
                     }



                    

                    if (obj.AreaEN != null)
                    {
                        DbParameter prmAreaEN = con.createParameter();
                        prmAreaEN.ParameterName = "@AreaEN";
                        prmAreaEN.DbType =DbType.String;
                        if (obj.AreaEN == null)
                        {
                            prmAreaEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaEN.Value = obj.AreaEN;
                        }
                        strWhere += " [AreaEN]=@AreaEN AND ";
                        lstParameters.Add(prmAreaEN);
                     }



                    

                    if (obj.IsBadSituation != null)
                    {
                        DbParameter prmIsBadSituation = con.createParameter();
                        prmIsBadSituation.ParameterName = "@IsBadSituation";
                        prmIsBadSituation.DbType =DbType.Int32;
                        if (obj.IsBadSituation == null)
                        {
                            prmIsBadSituation.Value = DBNull.Value;
                        }
                        else
                        {
                            prmIsBadSituation.Value = obj.IsBadSituation;
                        }
                        strWhere += " [IsBadSituation]=@IsBadSituation AND ";
                        lstParameters.Add(prmIsBadSituation);
                     }



                    


            if (strWhere != "")
                        strWhere = " where " + strWhere.Substring(0, strWhere.LastIndexOf("AND"));

                    

            

            List<TicketAllDetails> lstRet = Select(con, "", strWhere, lstParameters.ToArray());

            return lstRet;
        }


        public List<TicketAllDetails> Search(TicketAllDetails obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<TicketAllDetails> lstRet = Search(con,obj);

            con.CloseConnection();

            return lstRet;
        }


                

            
public List<TicketAllDetails> SearchOrLike(ClassDataHandler con, TicketAllDetails obj)
        {
            string strWhere = "";
            List<DbParameter> lstParameters = new List<DbParameter>();

            
                    if (obj.TicketID != -1)
                    {
                        DbParameter prmTicketID = con.createParameter();
                        prmTicketID.ParameterName = "@TicketID";
                        prmTicketID.DbType =DbType.Int64;
                        if (obj.TicketID == null)
                        {
                            prmTicketID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmTicketID.Value = obj.TicketID;
                        }
                        strWhere += " [TicketID]=@TicketID OR ";
                        lstParameters.Add(prmTicketID);
                     }



                    

                    if (obj.OwnerID != null)
                    {
                        DbParameter prmOwnerID = con.createParameter();
                        prmOwnerID.ParameterName = "@OwnerID";
                        prmOwnerID.DbType =DbType.Int64;
                        if (obj.OwnerID == null)
                        {
                            prmOwnerID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOwnerID.Value = obj.OwnerID;
                        }
                        strWhere += " [OwnerID]=@OwnerID OR ";
                        lstParameters.Add(prmOwnerID);
                     }



                    

                    if (obj.Badge != null)
                    {
                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType =DbType.String;
                        if (obj.Badge == null)
                        {
                            prmBadge.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBadge.Value = obj.Badge;
                        }
                        strWhere += " [Badge] LIKE @Badge OR ";
                        lstParameters.Add(prmBadge);
                     }



                    

                    if (obj.PersonNameEN != null)
                    {
                        DbParameter prmPersonNameEN = con.createParameter();
                        prmPersonNameEN.ParameterName = "@PersonNameEN";
                        prmPersonNameEN.DbType =DbType.String;
                        if (obj.PersonNameEN == null)
                        {
                            prmPersonNameEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonNameEN.Value = obj.PersonNameEN;
                        }
                        strWhere += " [PersonNameEN] LIKE @PersonNameEN OR ";
                        lstParameters.Add(prmPersonNameEN);
                     }



                    

                    if (obj.PersonNameAR != null)
                    {
                        DbParameter prmPersonNameAR = con.createParameter();
                        prmPersonNameAR.ParameterName = "@PersonNameAR";
                        prmPersonNameAR.DbType =DbType.String;
                        if (obj.PersonNameAR == null)
                        {
                            prmPersonNameAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonNameAR.Value = obj.PersonNameAR;
                        }
                        strWhere += " [PersonNameAR] LIKE @PersonNameAR OR ";
                        lstParameters.Add(prmPersonNameAR);
                     }



                    

                    if (obj.RequestTypeID != null)
                    {
                        DbParameter prmRequestTypeID = con.createParameter();
                        prmRequestTypeID.ParameterName = "@RequestTypeID";
                        prmRequestTypeID.DbType =DbType.Int64;
                        if (obj.RequestTypeID == null)
                        {
                            prmRequestTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeID.Value = obj.RequestTypeID;
                        }
                        strWhere += " [RequestTypeID]=@RequestTypeID OR ";
                        lstParameters.Add(prmRequestTypeID);
                     }



                    

                    if (obj.RequestTypeAR != null)
                    {
                        DbParameter prmRequestTypeAR = con.createParameter();
                        prmRequestTypeAR.ParameterName = "@RequestTypeAR";
                        prmRequestTypeAR.DbType =DbType.String;
                        if (obj.RequestTypeAR == null)
                        {
                            prmRequestTypeAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeAR.Value = obj.RequestTypeAR;
                        }
                        strWhere += " [RequestTypeAR] LIKE @RequestTypeAR OR ";
                        lstParameters.Add(prmRequestTypeAR);
                     }



                    

                    if (obj.RequestTypeEN != null)
                    {
                        DbParameter prmRequestTypeEN = con.createParameter();
                        prmRequestTypeEN.ParameterName = "@RequestTypeEN";
                        prmRequestTypeEN.DbType =DbType.String;
                        if (obj.RequestTypeEN == null)
                        {
                            prmRequestTypeEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRequestTypeEN.Value = obj.RequestTypeEN;
                        }
                        strWhere += " [RequestTypeEN] LIKE @RequestTypeEN OR ";
                        lstParameters.Add(prmRequestTypeEN);
                     }



                    

                    if (obj.Details != "")
                    {
                        DbParameter prmDetails = con.createParameter();
                        prmDetails.ParameterName = "@Details";
                        prmDetails.DbType =DbType.String;
                        if (obj.Details == null)
                        {
                            prmDetails.Value = DBNull.Value;
                        }
                        else
                        {
                            prmDetails.Value = obj.Details;
                        }
                        strWhere += " [Details] LIKE @Details OR ";
                        lstParameters.Add(prmDetails);
                     }



                    

                    if (obj.StatusID != null)
                    {
                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType =DbType.Int64;
                        if (obj.StatusID == null)
                        {
                            prmStatusID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusID.Value = obj.StatusID;
                        }
                        strWhere += " [StatusID]=@StatusID OR ";
                        lstParameters.Add(prmStatusID);
                     }



                    

                    if (obj.StatusAR != null)
                    {
                        DbParameter prmStatusAR = con.createParameter();
                        prmStatusAR.ParameterName = "@StatusAR";
                        prmStatusAR.DbType =DbType.String;
                        if (obj.StatusAR == null)
                        {
                            prmStatusAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusAR.Value = obj.StatusAR;
                        }
                        strWhere += " [StatusAR] LIKE @StatusAR OR ";
                        lstParameters.Add(prmStatusAR);
                     }



                    

                    if (obj.StatusEN != null)
                    {
                        DbParameter prmStatusEN = con.createParameter();
                        prmStatusEN.ParameterName = "@StatusEN";
                        prmStatusEN.DbType =DbType.String;
                        if (obj.StatusEN == null)
                        {
                            prmStatusEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusEN.Value = obj.StatusEN;
                        }
                        strWhere += " [StatusEN] LIKE @StatusEN OR ";
                        lstParameters.Add(prmStatusEN);
                     }



                    

                    if (obj.OperatorID != null)
                    {
                        DbParameter prmOperatorID = con.createParameter();
                        prmOperatorID.ParameterName = "@OperatorID";
                        prmOperatorID.DbType =DbType.Int64;
                        if (obj.OperatorID == null)
                        {
                            prmOperatorID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOperatorID.Value = obj.OperatorID;
                        }
                        strWhere += " [OperatorID]=@OperatorID OR ";
                        lstParameters.Add(prmOperatorID);
                     }



                    

                    if (obj.AssignedToAR != null)
                    {
                        DbParameter prmAssignedToAR = con.createParameter();
                        prmAssignedToAR.ParameterName = "@AssignedToAR";
                        prmAssignedToAR.DbType =DbType.String;
                        if (obj.AssignedToAR == null)
                        {
                            prmAssignedToAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAssignedToAR.Value = obj.AssignedToAR;
                        }
                        strWhere += " [AssignedToAR] LIKE @AssignedToAR OR ";
                        lstParameters.Add(prmAssignedToAR);
                     }



                    

                    if (obj.AssignedToEN != null)
                    {
                        DbParameter prmAssignedToEN = con.createParameter();
                        prmAssignedToEN.ParameterName = "@AssignedToEN";
                        prmAssignedToEN.DbType =DbType.String;
                        if (obj.AssignedToEN == null)
                        {
                            prmAssignedToEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAssignedToEN.Value = obj.AssignedToEN;
                        }
                        strWhere += " [AssignedToEN] LIKE @AssignedToEN OR ";
                        lstParameters.Add(prmAssignedToEN);
                     }



                    

                    if (obj.PriorityID != null)
                    {
                        DbParameter prmPriorityID = con.createParameter();
                        prmPriorityID.ParameterName = "@PriorityID";
                        prmPriorityID.DbType =DbType.Int64;
                        if (obj.PriorityID == null)
                        {
                            prmPriorityID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityID.Value = obj.PriorityID;
                        }
                        strWhere += " [PriorityID]=@PriorityID OR ";
                        lstParameters.Add(prmPriorityID);
                     }



                    

                    if (obj.PriorityAR != null)
                    {
                        DbParameter prmPriorityAR = con.createParameter();
                        prmPriorityAR.ParameterName = "@PriorityAR";
                        prmPriorityAR.DbType =DbType.String;
                        if (obj.PriorityAR == null)
                        {
                            prmPriorityAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityAR.Value = obj.PriorityAR;
                        }
                        strWhere += " [PriorityAR] LIKE @PriorityAR OR ";
                        lstParameters.Add(prmPriorityAR);
                     }



                    

                    if (obj.PriorityEN != null)
                    {
                        DbParameter prmPriorityEN = con.createParameter();
                        prmPriorityEN.ParameterName = "@PriorityEN";
                        prmPriorityEN.DbType =DbType.String;
                        if (obj.PriorityEN == null)
                        {
                            prmPriorityEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPriorityEN.Value = obj.PriorityEN;
                        }
                        strWhere += " [PriorityEN] LIKE @PriorityEN OR ";
                        lstParameters.Add(prmPriorityEN);
                     }



                    

                    if (obj.TicketDuration != null)
                    {
                        DbParameter prmTicketDuration = con.createParameter();
                        prmTicketDuration.ParameterName = "@TicketDuration";
                        prmTicketDuration.DbType =DbType.Int64;
                        if (obj.TicketDuration == null)
                        {
                            prmTicketDuration.Value = DBNull.Value;
                        }
                        else
                        {
                            prmTicketDuration.Value = obj.TicketDuration;
                        }
                        strWhere += " [TicketDuration]=@TicketDuration OR ";
                        lstParameters.Add(prmTicketDuration);
                     }



                    

                    if (obj.CreateTime != DateTime.Now)
                    {
                        DbParameter prmCreateTime = con.createParameter();
                        prmCreateTime.ParameterName = "@CreateTime";
                        prmCreateTime.DbType =DbType.DateTime;
                        if (obj.CreateTime == null)
                        {
                            prmCreateTime.Value = DBNull.Value;
                        }
                        else
                        {
                            prmCreateTime.Value = obj.CreateTime;
                        }
                        strWhere += " [CreateTime]=@CreateTime OR ";
                        lstParameters.Add(prmCreateTime);
                     }



                    

                    if (obj.ModifyTime != DateTime.Now)
                    {
                        DbParameter prmModifyTime = con.createParameter();
                        prmModifyTime.ParameterName = "@ModifyTime";
                        prmModifyTime.DbType =DbType.DateTime;
                        if (obj.ModifyTime == null)
                        {
                            prmModifyTime.Value = DBNull.Value;
                        }
                        else
                        {
                            prmModifyTime.Value = obj.ModifyTime;
                        }
                        strWhere += " [ModifyTime]=@ModifyTime OR ";
                        lstParameters.Add(prmModifyTime);
                     }



                    

                    if (obj.Note != "")
                    {
                        DbParameter prmNote = con.createParameter();
                        prmNote.ParameterName = "@Note";
                        prmNote.DbType =DbType.String;
                        if (obj.Note == null)
                        {
                            prmNote.Value = DBNull.Value;
                        }
                        else
                        {
                            prmNote.Value = obj.Note;
                        }
                        strWhere += " [Note] LIKE @Note OR ";
                        lstParameters.Add(prmNote);
                     }



                    

                    if (obj.AreaID != null)
                    {
                        DbParameter prmAreaID = con.createParameter();
                        prmAreaID.ParameterName = "@AreaID";
                        prmAreaID.DbType =DbType.Int64;
                        if (obj.AreaID == null)
                        {
                            prmAreaID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaID.Value = obj.AreaID;
                        }
                        strWhere += " [AreaID]=@AreaID OR ";
                        lstParameters.Add(prmAreaID);
                     }



                    

                    if (obj.AreaAR != null)
                    {
                        DbParameter prmAreaAR = con.createParameter();
                        prmAreaAR.ParameterName = "@AreaAR";
                        prmAreaAR.DbType =DbType.String;
                        if (obj.AreaAR == null)
                        {
                            prmAreaAR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaAR.Value = obj.AreaAR;
                        }
                        strWhere += " [AreaAR] LIKE @AreaAR OR ";
                        lstParameters.Add(prmAreaAR);
                     }



                    

                    if (obj.AreaEN != null)
                    {
                        DbParameter prmAreaEN = con.createParameter();
                        prmAreaEN.ParameterName = "@AreaEN";
                        prmAreaEN.DbType =DbType.String;
                        if (obj.AreaEN == null)
                        {
                            prmAreaEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmAreaEN.Value = obj.AreaEN;
                        }
                        strWhere += " [AreaEN] LIKE @AreaEN OR ";
                        lstParameters.Add(prmAreaEN);
                     }



                    

                    if (obj.IsBadSituation != null)
                    {
                        DbParameter prmIsBadSituation = con.createParameter();
                        prmIsBadSituation.ParameterName = "@IsBadSituation";
                        prmIsBadSituation.DbType =DbType.Int32;
                        if (obj.IsBadSituation == null)
                        {
                            prmIsBadSituation.Value = DBNull.Value;
                        }
                        else
                        {
                            prmIsBadSituation.Value = obj.IsBadSituation;
                        }
                        strWhere += " [IsBadSituation]=@IsBadSituation OR ";
                        lstParameters.Add(prmIsBadSituation);
                     }



                    


            if (strWhere != "")
                        strWhere = " where " + strWhere.Substring(0, strWhere.LastIndexOf("OR"));

                    

            

            List<TicketAllDetails> lstRet = Select(con, "", strWhere, lstParameters.ToArray());

            return lstRet;
        }


        public List<TicketAllDetails> SearchOrLike(TicketAllDetails obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<TicketAllDetails> lstRet = SearchOrLike(con,obj);

            con.CloseConnection();

            return lstRet;
        }


                
        


       
        



    }
}











            